const { log } = require("console");

module.exports=async(hre)=>{ 
    const {deployments, getNamedAccounts} = hre;
    const {deployer} = await getNamedAccounts();
    //1、部署nft
    const factory = await hre.ethers.getContractFactory("MyNFT");
    const proxy = await hre.upgrades.deployProxy(factory, [], { initializer: "initialize" });
    // await proxy.waitForDeployment();
    console.log("MyNFT proxy address:", await proxy.getAddress());
    // console.log("MyNFT implementation address:", await hre.upgrades.erc1967.getImplementationAddress(proxy.target));
    
    deployments.save("proxyNft",{
        abi: factory.interface.format("json"),
        address: proxy.target,
        args: [],
        contract: "MyNFT",
        from:deployer,
        log:true
    });
}

module.exports.tags = ["nftV1"];